Filter Editor

The Filter Editor component provides an efficient method for applying filters to external data sources defined by a business rule through a data adapter.

Data Adapter

A data adapter is required to gather information for the Filter Editor. Column names and data types are pulled from the first data table. A second data table can be created if the column display names must be altered.

NOTE: The second data table must contain the same number of columns in the same order as the first table. Only column definitions, not data, need to be in the second table.

Follow these steps to create a data adapter for Filter Editor:

  1. Define the Data Table using a business rule.

    Define the Data Table using a Business Rule with C# or VB

    Copy

    C#

    case DashboardDataSetFunctionType.GetDataSetNames:
        List<string> names = new List<string>(); 
        names.Add("MyDataSet") ; 
        return names;
    case DashboardDataSetFunctionType.GetDataSet:
        if (args.DataSetName.XFEqualsIgnoreCase("MyDataSet"))
        {
            DataSet ds = new DataSet("DataFilterTestDataSet"); 
            ds.Tables.Add(CreateMainDataTable(si)); 
            ds.Tables.Add(CreateColumnHeaderDataTable(si)) ;
  2. (Optional) To alter the Filter Editor column names for display, create a second Data Table and define new column names.

    Copy
    C#
    DataTable dt = new DataTable("DataTable1");

    // Create the columns
    dt.Columns.Add(new DataColumn("Name", typeof(String)) { ReadOnly = false, MaxLength = -1});
    dt.Columns.Add(new DataColumn("ID", typeof(Guid)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("EmpNum", typeof(Int64)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("DeptId", typeof(Int32)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("DivId",  typeof(Int16)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("HireDate", typeof(DateTime)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("Position", typeof(String)) { ReadOnly = false, MaxLength = -1});
    dt.Columns.Add(new DataColumn("IsActive", typeof(Boolean)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("Salary", typeof(Decimal)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("BonusRate",typeof(Double)) { ReadOnly = false});
    dt.Columns.Add(new DataColumn("Manager", typeof(String)) { ReadOnly = false, MaxLength = -1});
  3. Create the data adapter. From the Command Type property, select Method and attach the business rule. See Data Adapters.

    Create the Data Adapter and attach the business rule using the Method Command Type.

  4. Create the Filter Editor dashboard component, then attach the data adapter and define the properties. See Dashboard Components

Settings

Date Filter Format

Select a format for the appearance of data in the filter editor.

Output Format

Change the output format to JSON or XML.

Enable Apply Button

When set to True, this property enables users to build the formula and manually select when to apply it. When set to False, the filter runs automatically after each session.

Enable Clear Button

When set to True, this property enables users to use the Clear icon to clear the entire editor at once. When set to False, this property removes the Clear icon and users can only delete a single formula at a time.

Build the Filter

Navigate to the dashboard and select the View Dashboard icon. Filter your data using the Filter Editor component.

The Filter Editor is outlined on the dashboard

Build your filter using operators And, Or, Not And, and Not Or as part of a Condition, Group, or Custom Expression.

Build your filter using operators And, Or, Not And, and Not Or as part of a Condition, Group, or Custom Expression.

Select the + icon to add a Condition. Use the drop-down menu to select a Condition, Group, or Custom Expression. Select the x icon when hovering over a condition to delete that line item.

Select the Apply button to filter your data based on the filter. Select the Clear button to remove the entire filter.

Select each checkbox for a valid drop-down menu of choices or for the ability to enter text.

NOTE: Select Add Custom Expression to display the Expression Editor dialog box. Double-click each selection to build your expression and then select the OK button. Select the Apply button to run the filter.